package top.tangyh.lamp.care.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.tangyh.basic.base.R;
import top.tangyh.basic.interfaces.echo.EchoService;
import top.tangyh.basic.base.controller.SuperController;
import top.tangyh.lamp.care.service.BPatEventService;
import top.tangyh.lamp.care.entity.BPatEvent;
import top.tangyh.lamp.care.vo.save.BPatEventSaveVO;
import top.tangyh.lamp.care.vo.save.EventInputVO;
import top.tangyh.lamp.care.vo.update.BPatEventUpdateVO;
import top.tangyh.lamp.care.vo.result.BPatEventResultVO;
import top.tangyh.lamp.care.vo.query.BPatEventPageQuery;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * 特殊事件表
 * </p>
 *
 * @author zqb
 * @date 2024-07-22 16:36:14
 * @create [2024-07-22 16:36:14] [zqb] [代码生成器生成]
 */
@Slf4j
@RequiredArgsConstructor
@Validated
@RestController
@RequestMapping("/sp/event")
@Tag(name = "特殊事件")
public class BPatEventController {
//    extends SuperController<BPatEventService, Long, BPatEvent
//            , BPatEventSaveVO, BPatEventUpdateVO, BPatEventPageQuery, BPatEventResultVO>
//    private final EchoService echoService;
//    @Override
//    public EchoService getEchoService() {
//        return echoService;
//    }

    private final BPatEventService bPatEventService;


    @Operation(summary = "新增特殊事件")
    @PostMapping
    public R addEvent(@RequestBody EventInputVO eventInputVO) {
        bPatEventService.addEvent(eventInputVO);
        return R.success();
    }


//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "hospitalNumber", value = "病人住院号", required = true)
//    })

    /**
     * @param hospitalNumber
     * @return
     */
    @Parameters({
            @Parameter(name = "hospitalNumber", description = "病人住院号", required = true),
    })
    @Operation(summary = "查询特殊事件")
    @GetMapping("/query")
    public R<List<BPatEvent>> queryEvent(@RequestParam String hospitalNumber) {
        List<BPatEvent> list = bPatEventService.queryEvent(hospitalNumber);
        return R.success(list);
    }

    @Operation(summary = "修改特殊事件")
    @PutMapping
    public R updateEvent(@RequestBody EventInputVO eventInputVO) {
        bPatEventService.updateEvent(eventInputVO);
        return R.success();
    }

    /**
     * @param id
     * @return
     */
    @Operation(summary = "删除特殊事件")
    @DeleteMapping
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "特殊事件主键", required = true)
//    })
    @Parameters({
            @Parameter(name = "id", description = "病人住特殊事件主键院号", required = true),
    })
    public R deleteEvent(@RequestParam Long id) {
        bPatEventService.deleteEvent(id);
        return R.success();
    }
}


